<!--_meta 作为公共模版分离出去-->
{include file="public/_meta"}


<article class="page-container">
    <form action="" method="post" class="form form-horizontal" id="form-send" enctype="multipart/form-data">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>发送对象：</label>
            <div class="formControls col-xs-8 col-sm-9">
               <span class="select-box">
					<select name="user_auth" class="select" id="">
                        <option value="">请选择</option>
                        <option value="2">全体教师</option>
                        <option value="3">全体学生</option>
                    </select>
				</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>标题：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="" name="title">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>发送内容：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea type="text" class="textarea" value="" placeholder="" id="" name="content"></textarea>
            </div>
        </div>

        <div class="row cl" >
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                <button class="btn btn-primary btn6 mr10 radius" type="submit">发 送</button>
                <button onClick="parent.layer.close(parent.layer.getFrameIndex(window.name));" class="btn  btn6 mr10 radius" type="button">取消</button>
            </div>
        </div>
    </form>
</article>

<!--_footer 作为公共模版分离出去-->
{include file="public/_footer"}

<script type="text/javascript">
    $(function(){
        var onOff = true;
        $(".check_all").click(function(){
            if(onOff){
                $("input[type=checkbox]").prop("checked",true);
                onOff = false;
            }else{
                $("input[type=checkbox]").prop("checked",false);
                onOff = true;
            }
        });
    });


    /*群发推送消息*/
    $("#form-send").validate({
        rules:{
            user_auth:{
                required:true
            },
            title:{
                required:true
            },
            content:{
                required:true
            }
        },
        onkeyup:false,
        focusCleanup:true,
        success:"valid",
        submitHandler:function(form){
            var data = $(form).serializeArray;
            $(form).ajaxSubmit({
                type: 'post',
                url: "{:url('information/send_information_mass')}",
                dataType: 'json',
                data: data,
                async : false,
                success: function(rec){
                    if(rec.status == true){
                        layer.msg(rec.message,{icon: 6,time:2000});
                        setTimeout(jump,1000);
                        function jump(){
                            parent.location.reload();
                        }
                    }else if(rec.status == false){
                        layer.msg(rec.message,{icon: 5,time:1000});
                    }
                }
            });
        }
    });

</script>

